package com.magic233.entity;

public class Workers implements Comparable{
    private Long id;

    private String type;

    private String username;

    private String phone;

    private Integer acceptnum;

    private Integer completenum;

    private String percentage;

    private Double score1;

    private Double score2;

    private Double score3;

    private Integer deleted;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Integer getAcceptnum() {
        return acceptnum;
    }

    public void setAcceptnum(Integer acceptnum) {
        this.acceptnum = acceptnum;
    }

    public Integer getCompletenum() {
        return completenum;
    }

    public void setCompletenum(Integer completenum) {
        this.completenum = completenum;
    }

    public Double getScore1() {
        return score1;
    }

    public void setScore1(Double score1) {
        this.score1 = score1;
    }

    public Double getScore2() {
        return score2;
    }

    public void setScore2(Double score2) {
        this.score2 = score2;
    }

    public Double getScore3() {
        return score3;
    }

    public void setScore3(Double score3) {
        this.score3 = score3;
    }

    public Integer getDeleted() {
        return deleted;
    }

    public void setDeleted(Integer deleted) {
        this.deleted = deleted;
    }

    public String getPercentage() {
        return percentage;
    }

    public void setPercentage(String percentage) {
        this.percentage = percentage;
    }

    @Override
    public int compareTo(Object o) {
        if (o instanceof Workers) {
            Workers workers = (Workers) o;
            int compare = Double.compare(Double.parseDouble(this.percentage.split("%")[0]), Double.parseDouble(workers.percentage.split("%")[0]));
            return compare;
        }else {
            throw new RuntimeException("传入的数据类型不一致");
        }
    }
}
